Hadouken Node.js adapter
Allows the use of the Hadouken API from node.js.
Requirements
Install as dependency
$ npm install -S hadouken-js-adapter
Usage
Connecting to an already running runtime
const { connect, Identity } = require("hadouken-js-adapter");
async function launchApp() {
const fin = await connect({
address: "ws://localhost:9696",
uuid: "my-uuid-123"
});
const version = await fin.System.getVersion();
console.log("Connected to Hadouken version", version);
await fin.Application.start({
name: "adapter-test-app",
url: 'http://hadouken.io/',
uuid: "adapter-test-app",
autoShow: true,
nonPersistent : true
});
}
launchApp().then(() => {
console.log("success");
}).catch((err) => {
console.log("Error trying to connect,", err.message);
console.log(err.stack);
});
Launching a runtime and connecting
const { connect, Identity } = require("hadouken-js-adapter");
async function launchApp() {
const fin = await connect({
uuid: "my-uuid-123",
runtime: {
version: 'stable'
}
});
const version = await fin.System.getVersion();
console.log("Connected to Hadouken version", version);
await fin.Application.start({
name: "adapter-test-app",
url: 'http://hadouken.io/',
uuid: "adapter-test-app",
autoShow: true,
nonPersistent : true
});
}
launchApp().then(() => {
console.log("success");
}).catch((err) => {
console.log("Error trying to connect,", err.message);
console.log(err.stack);
});
Note that either an address or a runtime object with version are required to connect
Mac and Linux Environment settings
In order to configure system policies, the js adapter respects the following group policy settings when set as environment variables on Mac and Linux:
- assetsUrl
- runtimeArgs
- runtimeDirectory
Local build
npm run build
Test
npm test -- --ver=alpha
Only executing tests that pattern match "Application"
npm test -- --ver=alpha --grep="Application"
Executing tests that do not pattern match "System"
npm test -- --ver=alpha --invert --grep="System"
Test with core
npm test -- --ver=alpha --build-core --core=~/core
or without specifying the core path (core will be cloned from GH into core
directory):
npm test -- --ver=alpha --build-core
Repl
To start the read-eval-print loop:
npm run repl -- --ver=alpha
Generated documentation
We use JSDoc for documentation and generating the documentation will require our custom JSDoc template. Use the following commands to execute the docs task:
git submodule init
git submodule update
npm run doc
License
The code in this repository is covered by the included license.
However, if you run this code, it may call on the OpenFin RVM or OpenFin Runtime, which are covered by OpenFin's Developer, Community, and Enterprise licenses. You can learn more about OpenFin licensing at the links listed below or just email us at support@openfin.co with questions.
https://openfin.co/developer-agreement/
https://openfin.co/licensing/